Skip to content

Commit b7fc0f1

Browse files
authored
MNTOR-4522 - Don't show Start a free scan if a user has already performed a scan (#5934)
* MNTOR-4522 - Don't show Start a free scann if a user has already performed a scan * MNTOR-4522 - Remove autoFocus from PFocusScope * undo commit * tests * remove unused story
1 parent ce29c65 commit b7fc0f1

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/Dashboard.test.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
DashboardUsNoPremiumScanInProgressUnresolvedBreaches,
4343
DashboardUsNoPremiumScanInProgressResolvedBreaches,
4444
DashboardUsNoPremiumNoScanNoBreachesDisabledScan,
45+
DashboardUsNoPremiumFirstScanRan,
4546
} from "./DashboardUSUsers.stories";
4647
import {
4748
DashboardUsPremiumEmptyScanNoBreaches,
@@ -3126,6 +3127,18 @@ it("send telemetry when users click on exposure chart free scan", async () => {
31263127
);
31273128
});
31283129

3130+
it("shows the exposure chart free scan button if scan has not been performed", () => {
3131+
const ComposedDashboard = composeStory(
3132+
DashboardUsNoPremiumNoScanNoBreaches,
3133+
Meta,
3134+
);
3135+
render(<ComposedDashboard />);
3136+
const ctaButton = screen.queryAllByRole("link", {
3137+
name: "Start a free scan",
3138+
});
3139+
expect(ctaButton[0]).toBeInTheDocument();
3140+
});
3141+
31293142
describe("CSAT survey banner", () => {
31303143
it("does not display the “automatic removal” CSAT survey banner on the dashboard tab “action needed” to Plus users", () => {
31313144
const ComposedDashboard = composeStory(
@@ -4091,4 +4104,16 @@ describe("Upsell badge", () => {
40914104
"https://payments-next.stage.fxa.nonprod.webservices.mozgcp.net/monitorplusstage/monthly/landing?form_type=button&entrypoint=monitor.mozilla.org-monitor-in-product-navigation-upsell&utm_source=product&utm_medium=monitor&utm_campaign=navigation-upsell",
40924105
);
40934106
});
4107+
4108+
it("does not show the start free scan component if a user has already run a scan", () => {
4109+
const ComposedDashboard = composeStory(
4110+
DashboardUsNoPremiumFirstScanRan,
4111+
Meta,
4112+
);
4113+
render(<ComposedDashboard />);
4114+
const homeAddressString = screen.queryByText(
4115+
"Home address, family members and more are not yet included.",
4116+
);
4117+
expect(homeAddressString).not.toBeInTheDocument();
4118+
});
40944119
});

src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/DashboardUSUsers.stories.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ export const DashboardUsNoPremiumNoScanNoBreaches: Story = {
280280
premium: false,
281281
breaches: "empty",
282282
brokers: "no-scan",
283+
totalNumberOfPerformedScans: 0,
283284
},
284285
};
285286

@@ -445,3 +446,13 @@ export const DashboardUsNoPremiumScanInProgressResolvedBreaches: Story = {
445446
brokers: "scan-in-progress",
446447
},
447448
};
449+
450+
export const DashboardUsNoPremiumFirstScanRan: Story = {
451+
name: "US user, without Premium, first scan ran",
452+
args: {
453+
countryCode: "us",
454+
premium: false,
455+
brokers: "scan-in-progress",
456+
totalNumberOfPerformedScans: undefined,
457+
},
458+
};

src/app/components/client/Chart.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,12 @@ export const DoughnutChart = (props: Props) => {
153153
);
154154

155155
const getPromptContent = () => {
156-
if (!props.scanInProgress && props.isEligibleForPremium) {
156+
if (
157+
!props.scanInProgress &&
158+
props.isEligibleForPremium &&
159+
(props.totalNumberOfPerformedScans === undefined ||
160+
props.totalNumberOfPerformedScans === 0)
161+
) {
157162
return (
158163
<>
159164
<p>

0 commit comments

Comments
 (0)